import cv2
# 图片 打开，展示，另存
# graph = cv2.imread('01.jpg',1)
# k = cv2.waitKey(1)
# cv2.namedWindow('lina',cv2.WINDOW_AUTOSIZE)
# cv2.waitKey(1)
# cv2.imshow( 'lina' ,graph)
# k = cv2.waitKey(0)
# if k == ord("s") :
#    cv2.imwrite('mary.jpg',graph)
# cv2.destroyAllWindows()


# 摄像头相关
# A = cv2.VideoCapture(0)

#    获取捕获的分辨率
# propId可以直接写数字，也可以用OpenCV的符号表示
# width, height = A.get(3), A.get(4)
# print(width, height)

#    以原分辨率的一倍来捕获
# A.set(cv2.CAP_PROP_FRAME_WIDTH, width * 2)
# A.set(cv2.CAP_PROP_FRAME_HEIGHT, height * 2)
#
# while(True):
#    获取一帧
#   ret ,frame = A.read()
#   gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
#   cv2.imshow("capture",gray)
#
#   cv2.waitKey(0)
#   cv2.destroyAllWindows()
#   break

# 读取视频并播放
Video = cv2.VideoCapture(0)
while(Video.isOpened()):
    ret, frame = Video.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    cv2.imshow('Video', gray)
    if cv2.waitKey(2) == ord('q'):



